package com.zzw.basic.classloader;

import java.lang.reflect.Field;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.Map;

public class GenericTest {

	private Map<String,Integer> score;
	
	public static void main(String[] args) throws Exception, SecurityException {
		Class<GenericTest> clazz = GenericTest.class;
		Field f = clazz.getDeclaredField("score");
		Class<?> a = f.getType();
		System.out.println("score��������:" + a);
		Type gType = f.getGenericType();
		if(gType instanceof ParameterizedType){
			ParameterizedType pType = (ParameterizedType) gType;
			Type rType = pType.getRawType();
			System.out.println("ԭʼ������:" + rType);
			Type[] tArgs = pType.getActualTypeArguments();
			System.out.println("������Ϣ��:");
			for(int i = 0;i < tArgs.length;i++){
				System.out.println("��" + i + "������������:" + tArgs[i]);
			}
		}
		else{
			System.out.println("��ȡ�������ͳ���");
		}
	}
}
